package com.fzhucc.modules.lesson.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.sql.Timestamp;

/**
* @description /
* @author yyg
* @date 2022-12-07
**/
@Entity
@Data
@Table(name="tb_lesson_record")
public class LessonRecord implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    @ApiModelProperty(value = "id")
    private Integer id;

    @Column(name = "`lesson_id`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "课程id")
    private Integer lessonId;

    @Column(name = "`user_id`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "userid")
    private Long userId;

    @Column(name = "`buy_time`")
    @ApiModelProperty(value = "购买时间")
    private Timestamp buyTime;

    @ApiModelProperty(value = "地区划分 即什么地区看的到什么地区的数据,省的看到全部")
    @Column(name = "`org_area`",nullable = false)
    @NotNull
    public String orgArea;

    public void copy(LessonRecord source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
